package com.example.demo.utils.base;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;

/**
 * 顶级实体类
 */
@Data
public class BaseData implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     * @JsonSerialize 防止数据显示到前端时精度丢失
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 是否已删除
     */
    @TableLogic
    private Integer isDeleted;

    /** 分页参数 */
    @TableField(exist=false)
    private Integer pageSize = -1;
    @TableField(exist=false)
    private Integer current = 1;

}
